counterfactual_markups_table <- function(){
  
  # Loading Counterfactual Results
  indtable_list <- list()
  sgtable_list <- list()
  indtable_list$mkup0 <- read.csv("../release/counterfactuals/lowrisk_simplemh_censor0.2/fixedmarkup0/indmarketoutcomes.csv")
  indtable_list$mkup10 <- read.csv("../release/counterfactuals/lowrisk_simplemh_censor0.2/fixedmarkup10/indmarketoutcomes.csv")
  indtable_list$mkup25 <- read.csv("../release/counterfactuals/lowrisk_simplemh_censor0.2/fixedmarkup25/indmarketoutcomes.csv")
  sgtable_list$mkup0 <- read.csv("../release/counterfactuals/lowrisk_simplemh_censor0.2/fixedmarkup0/sgmarketoutcomes.csv")
  sgtable_list$mkup10 <- read.csv("../release/counterfactuals/lowrisk_simplemh_censor0.2/fixedmarkup10/sgmarketoutcomes.csv")
  sgtable_list$mkup25 <- read.csv("../release/counterfactuals/lowrisk_simplemh_censor0.2/fixedmarkup25/sgmarketoutcomes.csv")
  
  # Make levels table
  indtable <- matrix(rep(0, 5 * 4), 5, 4)
  sgtable <- matrix(rep(0, 5 * 4), 5, 4)
  ## Add base column
  indtable[, 1] <- indtable_list$mkup0[c(2:3, 10:12), 1]
  sgtable[, 1] <- sgtable_list$mkup0[c(2:3, 11:13), 1]
  ## Add markup columns
  for(i in 1:3){
    indtable[,1 + i] <- indtable_list[[i]][c(2:3, 10:12), 6]
    sgtable[,1 + i] <- sgtable_list[[i]][c(2:3, 11:13), 6]
  }
  
  # Loading Small Group Consumer Surplus Estimates
  fee_sg_cs <- read.csv("../release/fee_sg_cs/SG_CS_results.txt")
  
  # Add the prefered CS measure to the sg table"
  sg_cs_orig <- fee_sg_cs[which(fee_sg_cs$Type == "CS: >.05 ; No Outside Option; Zero Fees"), 2]
  
  #Change to change table
  indtable[1, ] <- (indtable[1, ] - indtable_list$mkup0[2, 1])   
  sgtable[1, ] <- ifelse(is.na(sgtable[1, ]), 0, (sgtable[1, ] - sg_cs_orig))   

  rownames <- list(
    c("\\quad Consumer surplus, change from base",
      "\\quad Government expenditure"), 
    c("\\quad Bronze",
      "\\quad Silver",
      "\\quad Gold"), 
    c("\\quad Consumer surplus, change from base",
      "\\quad Government expenditure"), 
    c("\\quad Bronze",
      "\\quad Silver",
      "\\quad Gold")
  )
  
  MakeLatexTableAdj(
    startcodelist = list(
      "\\begin{table}[H]",
      "\\centering",
      "\\caption{Counterfactual results: varying markups}",
      "\\begin{tabular}{lcccc}",
      "& & & & \\tabularnewline",
      "\\hline", 
      "\\hline", 
      "\\multicolumn{5}{c}{Panel A: Individual market}\\\\",
      "\\multicolumn{5}{c}{(N = 178,157)}\\\\",
      "\\midrule",
      "Counterfactual: & Base &\\multicolumn{3}{c}{Mandated insurance}\\\\",
      "\\cmidrule(lr){2-2} \\cmidrule(lr){3-5}",
      "Markup (in \\%): & 0 & 0 & 10 & 25\\\\",
      "\\cmidrule(lr){2-2} \\cmidrule(lr){3-3} \\cmidrule(lr){4-4} \\cmidrule(lr){5-5} ",
      "\\emph{Welfare} & & & &\\\\"),
    tableinnardslist = list(100 * indtable[1:2, ], 100 * indtable[3:5, ], 100 * sgtable[1:2, ], 100 * sgtable[3:5, ]),
    tableinnardsroundvec = c(0, 0, 0, 0), 
    inbetweencodelistlist = list(
      list(
        "\\emph{Standardized gross premiums} & & & & \\\\"
      ), 
      list(
        "\\multicolumn{5}{c}{ } \\\\",
        "\\multicolumn{5}{c}{Panel B: Small group market} \\\\",
        "\\multicolumn{5}{c}{(Base: N = 55,374; Merged: N =  125,527)} \\\\",
        "\\midrule",
        "\\emph{Welfare} & & & & \\\\"),
      list(
        "\\emph{Standardized gross premiums} & & & & \\\\"
      )),
    endcodelist = list(
      "\\hline", 
      "\\hline", 
      "\\end{tabular}",
      "\\label{tab:main_t_ctfl_mrkups}",
      "\\end{table}"), 
    rownames = rownames
  )
}
